{% extends "base/content.html" %}
{% load crispy_forms_tags %}
{% block title %}
  {% blocktrans with instance_name=category.name %}
    Delete category {{ instance_name }}
  {% endblocktrans %}
{% endblock %}
{% block content %}
  <h5 class="">
    {% blocktrans with instance_name=category.name %}
        Delete category {{ instance_name }} .
      {% endblocktrans %}
  </h5>
  <p>
    <dl>
      <dt>{% trans 'Category Name' %}</dt>
      <dd>
        {{ category.name }}
      </dd>
      <dt>{% trans 'Created at' %}</dt>
      <dd>
        {{ category.created_at }}
      </dd>
      <dt>{% trans 'Priority' %}</dt>
      <dd>
        {{ category.priority }}
      </dd>
      <dt>{% trans 'Pin to consumptions top' %}</dt>
      <dd>
        {% if category.pin_to_consumptions_top %}
          {% trans "Yes" %}
        {% else %}
          {% trans "No" %}
        {% endif %}
      </dd>

      <dt>{% trans 'Is Disabled' %}</dt>
      <dd>
        {% if category.is_disabled %}
          {% trans "Yes" %}
        {% else %}
          {% trans "No" %}
        {% endif %}
      </dd>
    </dl>
  </p>
  <p class="text-danger">
    {% blocktrans %}
    Are you sure you want to delete this category? This operation is irreversible.
    {% endblocktrans%}
  </p>
  <div class="py-3 fixed-bottom text-end bg-dark">
    <form method="post"
          action="{% url 'canteen:delete_category' category.pk %}"
          style="display: inline">
      {% csrf_token %}
      <button type="submit" class="btn btn-danger">{% trans 'Delete' %}</button>
      <button type="button" class="btn btn-primary" onclick="window.close();">
        {% trans "Cancel" %}
      </button>
    </form>
  </div>
  <script>
    const elements = document.querySelectorAll('dd');
    localize_content("dd")
  </script>
{% endblock %}
